<%@page import="java.text.DateFormat"%>
<%@ page language="java" import="java.sql.*,java.util.*"%>
<%@page import="java.text.SimpleDateFormat"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link href="<%=application.getContextPath()%>/css/css-crm.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="<%=application.getContextPath()%>/css/datatable.css"/>
<script type="text/javascript" src="<%=application.getContextPath()%>/js/jquery-1.6.min.js"></script>	
<script language="JavaScript" src="<%=application.getContextPath()%>/js/gen_validatorv4.js"
    type="text/javascript" ></script>
<script type="text/javascript" src="<%=application.getContextPath()%>/js/jquery.validate.js"></script>	
<script type="text/javascript" src="<%=application.getContextPath()%>/js/jquery.validate.min.js"></script>
<script type="text/javascript" src="<%=application.getContextPath()%>/js/jquery-1.7.2.min.js"></script>
<script language="javaScript" src="<%=application.getContextPath()%>/js/jquery-ui-1.8.20.custom.min.js"></script>

<script type="text/javascript" src="<%=application.getContextPath()%>/js/jquery-ui-1.8.17.custom.min.js"></script>
<script type="text/javascript" src="<%=application.getContextPath()%>/js/colResizable-1.3.min.js"></script>
 <script type="text/javascript" language="javascript" src="<%=application.getContextPath()%>/js/jquery.dataTables.nightly.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script  type="text/javascript">
$(document).ready(function() {
		$('#pendEnq').dataTable();
	} );
</script>

</head>
<body>
<div id="main" >
  <div id="content">
<div id="work-area2">
      <div class="heading2">Search Enquiry</div>
	  
      <div class="boxIFS">
        <form id="form1" name="form1" method="post" action="">
        <%  
       
        
    	Calendar currentDate = Calendar.getInstance();
		DateFormat formater = new SimpleDateFormat("yyyy-MM-dd");
		String dateNow = formater.format(currentDate.getTime());
        String datearr[]=dateNow.split("-");
        
         System.out.println("the current system month is"+datearr[1]);
         System.out.println("the current system year is"+datearr[0]);
        %>
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td align="right">&nbsp;</td>
              <td align="right">&nbsp;</td>
              <td align="right" valign="middle">&nbsp;</td>
              <td align="right" valign="middle">&nbsp;</td>
              <td align="left" valign="middle">&nbsp;</td>
              <td align="left" valign="middle">&nbsp;</td>
              <td align="left" valign="middle">&nbsp;</td>
            </tr>
            <tr>
              <td width="14%" align="right"><strong>Search By</strong></td>
              <td width="11%" align="right">&nbsp;  </td>
              <td width="23%" align="right" valign="middle">
              <select name="month"  class="form" id="month">
       
                <option value="01" <%if(datearr[1].equals("01")){ %>selected="selected"  <%} %> >Jan</option>
                <option value="02" <%if(datearr[1].equals("02")){ %>selected="selected"  <%} %> >Feb</option>
                <option value="03" <%if(datearr[1].equals("03")){ %>selected="selected"  <%} %>  >Mar</option>
                <option value="04" <%if(datearr[1].equals("04")){ %>selected="selected"  <%} %>  >Apr</option>
                <option value="05" <%if(datearr[1].equals("05")){ %>selected="selected"  <%} %>  >May</option>
                <option value="06" <%if(datearr[1].equals("06")){ %>selected="selected"  <%} %> >Jun</option>
                <option value="07" <%if(datearr[1].equals("07")){ %>selected="selected"  <%} %>  >Jul</option>
                <option value="08" <%if(datearr[1].equals("08")){ %>selected="selected"  <%} %>  >Aug</option>
                <option value="09" <%if(datearr[1].equals("09")){ %>selected="selected"  <%} %>  >Sep</option>
                <option value="10" <%if(datearr[1].equals("10")){ %>selected="selected"  <%} %>  >Oct</option>
                <option value="11" <%if(datearr[1].equals("11")){ %>selected="selected"  <%} %>  >Nov</option>
                <option value="12" <%if(datearr[1].equals("12")){ %>selected="selected"  <%} %>  >Dec</option>
                </select>
                      </td>
              <td width="6%" align="right" valign="middle">&nbsp;  </td>
              <td width="22%" align="left" valign="middle">
              <select name="year" class="form" id="year">
                <option value="2012" <%if(datearr[0].equals("2012")){ %>selected="selected"  <%} %> >2012</option>
                <option value="2013" <%if(datearr[0].equals("2013")){ %>selected="selected"  <%} %>  >2013</option>
                <option value="2014"<%if(datearr[0].equals("2014")){ %>selected="selected"  <%} %>  >2014</option>
                <option value="2015" <%if(datearr[0].equals("2015")){ %>selected="selected"  <%} %>  >2015</option>
                <option value="2016" <%if(datearr[0].equals("2016")){ %>selected="selected"  <%} %>  >2016</option>
                <option value="2017"<%if(datearr[0].equals("2017")){ %>selected="selected"  <%} %>  >2017</option>
                <option value="2018"<%if(datearr[0].equals("2018")){ %>selected="selected"  <%} %>  >2018</option>
                <option value="2019"<%if(datearr[0].equals("2019")){ %>selected="selected"  <%} %>  >2019</option>
                <option value="2020"<%if(datearr[0].equals("2020")){ %>selected="selected"  <%} %>  >2020</option>
                <option value="2021"<%if(datearr[0].equals("2021")){ %>selected="selected"  <%} %>  >2021</option>
                <option value="2022"<%if(datearr[0].equals("2022")){ %>selected="selected"  <%} %>  >2022</option>
                <option value="2023"<%if(datearr[0].equals("2023")){ %>selected="selected"  <%} %>  >2023</option>
                <option value="2024"<%if(datearr[0].equals("2024")){ %>selected="selected"  <%} %> >2024</option>
              <option value="2025"<%if(datearr[0].equals("2025")){ %>selected="selected"  <%} %> >2025</option>
              </select>
               </td>
              <td width="12%" align="left" valign="middle">
               <input type="button" class="button" value="Search" onClick="javascript: gerSearchEnqs()"/>
              </td>
              <td width="12%" align="left" valign="middle">&nbsp;</td>
            </tr>
            <tr>
              <td align="right">&nbsp;</td>
              <td align="right">&nbsp;</td>
              <td align="right" valign="top">&nbsp;</td>
              <td align="left" valign="middle">&nbsp;</td>
              <td align="left" valign="top">&nbsp;</td>
              <td align="left" valign="top">&nbsp;</td>
              <td align="left" valign="top">&nbsp;</td>
            </tr>
            <tr>
              <td align="right">&nbsp;</td>
              <td align="right">&nbsp;</td>
              <td colspan="3" align="center" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="48%">&nbsp;</td>
                  <td width="52%">&nbsp;</td>
                </tr>
              </table></td>
              <td align="left" valign="top">&nbsp;</td>
              <td align="left" valign="top">&nbsp;</td>
            </tr>
          </table>
        </form>
      </div>
	  
	 <div id="enqSrchTable"></div>
	  <div id="ajaxLoader" style="display:none" align="center"><img src="<%=application.getContextPath()%>/images/loading.gif"/></div>
    </div>
    </div>
    </div>
</body>
</html>
 <script type="text/javascript">
   function gerSearchEnqs(){
	  var mnth= $("#month").val();
	  var year= $("#year").val();
	  var data="mnth="+mnth+"&year="+year;
	  //alert(data);
	  $("#ajaxLoader").show();
	  $.ajax({
			url: "<%= application.getContextPath()%>/editEnq/edit.do", 
			mimetype: "text/html",
			method: "post",
			data: data,
			cache:false,
			success: function(res){
				
				$("#enqSrchTable").html(res);
				
			}

		}).done(function(html){
			$("#ajaxLoader").hide();
		  }).fail(function(html){
		  	$("#ajaxLoader").hide();
		  	alert("Failed To Load the Data");
		  });
   }
</script>